/**
 * chenxitech.cn Inc.
 * Copyright (c) 2017-2017 All Rights Reserved.
 */
package tbdp.tool;

import com.google.common.base.Joiner;

import tbdp.tool.util.VariableContext;
import tbdp.tool.util.VariableUtils;

/**
 * @author xbkaishui
 * @version $Id: RowKeyGenerator.java, v 0.1 2017-06-07 下午10:31 xbkaishui Exp $$
 */
public class RowKeyGenerator {

    public String generateRowKey(String table, String scode, String market, String suffix) {
        return Joiner.on("_").join(scode, market, suffix);
    }

    /**
     * 根据模版生成rowkey
     * @param table
     * @param template
     * @return
     */
    public String generateRowKey(String table, String template) {
        return VariableUtils.substituteVars(template, VariableContext.instance().getCtx());
    }
}
